<template>
	<view class="pushEvaluate">
		<tui-navigation-bar :titleSize="18" :titleLineHeight="18" :titlefontWeight="800" :isOpacity="false"
			:splitLine="true" @init="initNavigation" title="评论回复" backgroundColor="#fff" color="#000">
			<view class="tui-header-icon" :style="{ marginTop: top + 'px' }">
				<tui-icon name="arrowleft" color="#333" @click="back"></tui-icon>
			</view>
		</tui-navigation-bar>
		<view class="pushEvaluate_content" :style="{ marginTop: marginTop + 'px' }">
			<tui-textarea size="26" color="#666666" :borderBottom="false" :borderTop="false" minHeight="100rpx"
				autoHeight placeholder="请输入回复~" v-model="intro">
			</tui-textarea>
		</view>
		<view class="footer">
			<tui-form-button @click="saveAppraise" radius="70rpx" size="34" color="#fff" width="690rpx" height="84rpx"
				background="#2FD7D3">
				保存
			</tui-form-button>
		</view>
	</view>
</template>

<script>
	import { replyAppraise } from "@/http/api/appraise/appraise.js"  
	export default {
		data() {
			return {
				// 导航栏
				top: 0, //标题图标距离顶部距离
				marginTop:0,

				intro: '', // 评价内容
				commentId: ''
			}
		},
		onLoad(options) {
			if(options){
				this.commentId=options.id
			}
		},
		computed:{
			merchantId(){
				return this.$store.state.userShopDetails.id
			}
		},
		methods: {
			// 导航栏
			initNavigation(e) {
				this.top = e.top;
				this.marginTop = e.height
			},
			back() {
				uni.navigateBack({
							        delta: 1
							    });;
			},
			// 回复评论
			saveAppraise(){
				replyAppraise({
					id: '1871228669746397185',
					commentId: '1871228669746397185',//this.commentId,
					content: this.intro
				}).then(res => {
					if (res.code == 200) {
						 this.$utils.toast("评论已回复");
					} else {
						this.$utils.toast(res.msg);
					}
				}).catch(res => {
					this.$utils.toast(res);
				}).finally(()=>{
					setTimeout(()=>{
						uni.navigateBack({
							        delta: 1
							    });;
					},200)
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	@import "./replayAppraise.scss";

	.pushEvaluate {
		background-color: #fff;
		height: 100vh;
		width: 100vw;

		.tui-header-icon {
			width: 100%;
			position: fixed;
			top: 0;
			padding: 0 0 0 38rpx;
			display: flex;
			align-items: center;
			height: 32px;
			transform: translateZ(0);
			box-sizing: border-box;
		}

		.pushEvaluate_content {
			margin-left: 20rpx;
			padding-top: 45rpx;

			.tui-box-upload {
				margin-bottom: 100rpx;
			}
		}
	}
</style>